﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IBS.Model;

namespace IBS.Bll.Authority
{
    public class CodeCardValidator
    {
        private readonly IIbsContext _context;

        public CodeCardValidator(IIbsContext context)
        {
            _context = context;
        }

        public bool CodeCardCanBeMatched(CodeCard codeCard)
        {
            return _context.CodeCards.Count(cc => cc.Id == codeCard.Id && String.IsNullOrEmpty(cc.UserName)) == 1;

        }
    }
}
